(function(){"use strict";BX.namespace("BX.TileGrid");BX.TileGrid.Item=function(t){this.id=t.id;this.isDraggable=t.isDraggable||false;this.isDroppable=t.isDroppable||false;this.name=t.name;this.type=t.type;this.layout={container:null,checkbox:null};this.gridTile=null;this.dblClickDelay=180};BX.TileGrid.Item.prototype={bindEvents:function(){BX.addCustomEvent(window,"BX.TileGrid.Grid:lastSelectedItem",function(){})},getId:function(){return this.id},render:function(){var t=null;var e=false;this.layout.container=BX.create("div",{attrs:{className:this.gridTile.itemHeight?"ui-grid-tile-item ui-grid-tile-item-fixed-height":"ui-grid-tile-item"},style:{height:this.gridTile.itemHeight?this.gridTile.itemHeight+"px":null,margin:this.gridTile.getTileMargin()?this.gridTile.getTileMargin()+"px":null},dataset:{id:this.id},children:[this.gridTile.checkBoxing?this.getCheckBox():null,this.layout.content=BX.create("div",{attrs:{className:"ui-grid-tile-item-content"},children:[this.getContent()]})],events:{dblclick:function(i){t&&clearTimeout(t);e=true;this.handleDblClick.call(this,i);this.gridTile.resetSetMultiSelectMode();this.gridTile.resetSelectAllItems();this.gridTile.resetFromToItems()}.bind(this),click:function(i){t=setTimeout(function(){if(!e){this.handleClick.call(this,i)}e=false}.bind(this),this.dblClickDelay)}.bind(this)}});if(this.isDraggable){this.gridTile.dragger.registerItem(this.layout.container)}if(this.isDroppable){this.gridTile.dragger.registerDrop(this.layout.container)}return this.layout.container},isVisibleItem:function(){var t=this.layout.container.getBoundingClientRect();var e=document.body.getBoundingClientRect();if(t.top<0||t.bottom<0){return false}return e.height>t.top&&e.height>=t.bottom},afterRender:function(){},handleClick:function(t){this.focusItem();this.resetFocusItem();var e=this.gridTile;if(e.isKeyControlKey()){e.setMultiSelectMode();e.checkItem(e.getFirstCurrentItem())}if(!e.isLastSelectedItem()){if(!e.isMultiSelectMode()){e.unSelectItem(e.getCurrentItem())}}if(!e.getFirstCurrentItem()){e.setFirstCurrentItem(this)}if(e.isKeyPressedShift()){e.selectFromToItems(e.getFirstCurrentItem(),this);return}if(e.isMultiSelectMode()||e.isKeyPressedSelectAll()){if(!this.checked){e.checkItem(this);e.selectItem(this);e.setCurrentItem(this);e.setFirstCurrentItem(this)}else{e.unCheckItem(this);e.unSelectItem(this);if(e.isLastSelectedItem())e.resetSetMultiSelectMode()}return}if(this.selected){e.unSelectItem(this)}else{e.selectItem(this);e.unCheckItem(this);e.setCurrentItem(this);e.setFirstCurrentItem(this);if(e.isLastSelectedItem())e.resetSetMultiSelectMode()}},handleDblClick:function(t){},handleEnter:function(){},getContainer:function(){return this.layout.container},getCheckBox:function(){return this.layout.checkbox=BX.create("div",{props:{className:"ui-grid-tile-item-checkbox"},events:{click:function(t){if(this.gridTile.isLastSelectedItem())this.gridTile.resetSetMultiSelectMode();if(this!==this.gridTile.getCurrentItem()&&this.gridTile.isMultiSelectMode()){this.gridTile.checkItem(this.gridTile.getCurrentItem());this.gridTile.selectItem(this.gridTile.getCurrentItem())}this.gridTile.checkItem(this);this.gridTile.selectItem(this);this.gridTile.setCurrentItem(this);this.gridTile.setFirstCurrentItem(this);if(!this.gridTile.isLastSelectedItem()){if(this.gridTile.isMultiSelectMode())this.gridTile.checkItem(this.gridTile.getFirstCurrentItem())}this.focusItem();this.resetFocusItem();t.stopPropagation()}.bind(this)}})},getContent:function(){return null},focusItem:function(){this.layout.container.setAttribute("tabindex","1");this.layout.container.focus()},resetFocusItem:function(){this.layout.container.removeAttribute("tabindex")},removeNode:function(t){t=t!==false;var e=this.layout.container;if(!e.parentNode)return;if(!t){e.parentNode.removeChild(e);return}e.classList.add("ui-grid-tile-item-to-fade");e.style.width=e.offsetWidth+"px";BX.bind(e,"transitionend",function(){e.classList.add("ui-grid-tile-item-to-remove")});setTimeout(function(){e.parentNode.removeChild(e)},500)},animateNode:function(){var t=this.layout.container;t.classList.add("ui-grid-tile-item-to-receive");setTimeout(function(){t.classList.remove("ui-grid-tile-item-to-receive")},500)}}})();
//# sourceMappingURL=item.map.js